<template>
  <div class="container flex-al">
    <!-- <build-el-bread></build-el-bread> -->
    <div class="w100 report flex-al mt-20">
      <div v-if="tableData.length != 0" style="width: 100%">
        <build-el-report-list
          v-for="item in tableData"
          :key="item.newsId"
          :showDot="false"
          type="2"
          @handNes="handNes(item.newsId, item)"
          :title="item.title"
          :update-time="item.updateTime"
        ></build-el-report-list>
      </div>
      <div v-else class="no-data">暂无数据</div>
    </div>

    <el-pagination
      style="margin: 15px 0"
      background
      :page-size="pageSize"
      :current-page="pageNow"
      layout="prev, pager, next"
      @current-change="changePage"
      :total="total"
    ></el-pagination>
  </div>
</template>
<script>
import buildElBread from "@/components/build-el-bread";
import buildElReportList from "@/components/build-el-report-list";
export default {
  components: {
    buildElBread,
    buildElReportList,
  },
  data() {
    return {
      tableData: null,
      total: 0,
      pageSize: 15,
      pageNow: 1,
    };
  },
  async created() {
    await this.init(1);
  },
  methods: {
    handNes(id, item) {
      console.log(item);
      if (item.pcJumpLink) {
        window.open(item.pcJumpLink);
      } else if (item.mobileJumpLink) {
        window.open(item.mobileJumpLink);
      } else {
        this.toPage(id, "大赛报道");
      }
    },
    async init(page) {
      this.tableData = [];
      let tableData = await this.api.selectNewsList7(page, this.pageSize);
      this.total = tableData.total;
      this.tableData = tableData.list;
    },
    changePage(e) {
      this.pageNow = e;
      this.init(e);
    },
  },
};
</script>
<style lang="less" scoped>
html {
  background: #eee;
}
.report {
  background: #fff;
  padding: 30px 47px;
  // height: 1000px;
}
</style>
